<!DOCTYPE html><html><head>
      <title>README</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      
      <link rel="stylesheet" href="file:///c:\Users\Administrator\.vscode\extensions\shd101wyy.markdown-preview-enhanced-0.6.3\node_modules\@shd101wyy\mume\dependencies\katex\katex.min.css">
      
      
      
      
      
      
      
      
      
      <style>
      /**
 * prism.js Github theme based on GitHub's theme.
 * @author Sam Clarke
 */
code[class*="language-"],
pre[class*="language-"] {
  color: #333;
  background: none;
  font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  word-wrap: normal;
  line-height: 1.4;

  -moz-tab-size: 8;
  -o-tab-size: 8;
  tab-size: 8;

  -webkit-hyphens: none;
  -moz-hyphens: none;
  -ms-hyphens: none;
  hyphens: none;
}

/* Code blocks */
pre[class*="language-"] {
  padding: .8em;
  overflow: auto;
  /* border: 1px solid #ddd; */
  border-radius: 3px;
  /* background: #fff; */
  background: #f5f5f5;
}

/* Inline code */
:not(pre) > code[class*="language-"] {
  padding: .1em;
  border-radius: .3em;
  white-space: normal;
  background: #f5f5f5;
}

.token.comment,
.token.blockquote {
  color: #969896;
}

.token.cdata {
  color: #183691;
}

.token.doctype,
.token.punctuation,
.token.variable,
.token.macro.property {
  color: #333;
}

.token.operator,
.token.important,
.token.keyword,
.token.rule,
.token.builtin {
  color: #a71d5d;
}

.token.string,
.token.url,
.token.regex,
.token.attr-value {
  color: #183691;
}

.token.property,
.token.number,
.token.boolean,
.token.entity,
.token.atrule,
.token.constant,
.token.symbol,
.token.command,
.token.code {
  color: #0086b3;
}

.token.tag,
.token.selector,
.token.prolog {
  color: #63a35c;
}

.token.function,
.token.namespace,
.token.pseudo-element,
.token.class,
.token.class-name,
.token.pseudo-class,
.token.id,
.token.url-reference .token.variable,
.token.attr-name {
  color: #795da3;
}

.token.entity {
  cursor: help;
}

.token.title,
.token.title .token.punctuation {
  font-weight: bold;
  color: #1d3e81;
}

.token.list {
  color: #ed6a43;
}

.token.inserted {
  background-color: #eaffea;
  color: #55a532;
}

.token.deleted {
  background-color: #ffecec;
  color: #bd2c00;
}

.token.bold {
  font-weight: bold;
}

.token.italic {
  font-style: italic;
}


/* JSON */
.language-json .token.property {
  color: #183691;
}

.language-markup .token.tag .token.punctuation {
  color: #333;
}

/* CSS */
code.language-css,
.language-css .token.function {
  color: #0086b3;
}

/* YAML */
.language-yaml .token.atrule {
  color: #63a35c;
}

code.language-yaml {
  color: #183691;
}

/* Ruby */
.language-ruby .token.function {
  color: #333;
}

/* Markdown */
.language-markdown .token.url {
  color: #795da3;
}

/* Makefile */
.language-makefile .token.symbol {
  color: #795da3;
}

.language-makefile .token.variable {
  color: #183691;
}

.language-makefile .token.builtin {
  color: #0086b3;
}

/* Bash */
.language-bash .token.keyword {
  color: #0086b3;
}

/* highlight */
pre[data-line] {
  position: relative;
  padding: 1em 0 1em 3em;
}
pre[data-line] .line-highlight-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  background-color: transparent;
  display: block;
  width: 100%;
}

pre[data-line] .line-highlight {
  position: absolute;
  left: 0;
  right: 0;
  padding: inherit 0;
  margin-top: 1em;
  background: hsla(24, 20%, 50%,.08);
  background: linear-gradient(to right, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
  pointer-events: none;
  line-height: inherit;
  white-space: pre;
}

pre[data-line] .line-highlight:before, 
pre[data-line] .line-highlight[data-end]:after {
  content: attr(data-start);
  position: absolute;
  top: .4em;
  left: .6em;
  min-width: 1em;
  padding: 0 .5em;
  background-color: hsla(24, 20%, 50%,.4);
  color: hsl(24, 20%, 95%);
  font: bold 65%/1.5 sans-serif;
  text-align: center;
  vertical-align: .3em;
  border-radius: 999px;
  text-shadow: none;
  box-shadow: 0 1px white;
}

pre[data-line] .line-highlight[data-end]:after {
  content: attr(data-end);
  top: auto;
  bottom: .4em;
}html body{font-family:"Helvetica Neue",Helvetica,"Segoe UI",Arial,freesans,sans-serif;font-size:16px;line-height:1.6;color:#333;background-color:#fff;overflow:initial;box-sizing:border-box;word-wrap:break-word}html body>:first-child{margin-top:0}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{line-height:1.2;margin-top:1em;margin-bottom:16px;color:#000}html body h1{font-size:2.25em;font-weight:300;padding-bottom:.3em}html body h2{font-size:1.75em;font-weight:400;padding-bottom:.3em}html body h3{font-size:1.5em;font-weight:500}html body h4{font-size:1.25em;font-weight:600}html body h5{font-size:1.1em;font-weight:600}html body h6{font-size:1em;font-weight:600}html body h1,html body h2,html body h3,html body h4,html body h5{font-weight:600}html body h5{font-size:1em}html body h6{color:#5c5c5c}html body strong{color:#000}html body del{color:#5c5c5c}html body a:not([href]){color:inherit;text-decoration:none}html body a{color:#08c;text-decoration:none}html body a:hover{color:#00a3f5;text-decoration:none}html body img{max-width:100%}html body>p{margin-top:0;margin-bottom:16px;word-wrap:break-word}html body>ul,html body>ol{margin-bottom:16px}html body ul,html body ol{padding-left:2em}html body ul.no-list,html body ol.no-list{padding:0;list-style-type:none}html body ul ul,html body ul ol,html body ol ol,html body ol ul{margin-top:0;margin-bottom:0}html body li{margin-bottom:0}html body li.task-list-item{list-style:none}html body li>p{margin-top:0;margin-bottom:0}html body .task-list-item-checkbox{margin:0 .2em .25em -1.8em;vertical-align:middle}html body .task-list-item-checkbox:hover{cursor:pointer}html body blockquote{margin:16px 0;font-size:inherit;padding:0 15px;color:#5c5c5c;background-color:#f0f0f0;border-left:4px solid #d6d6d6}html body blockquote>:first-child{margin-top:0}html body blockquote>:last-child{margin-bottom:0}html body hr{height:4px;margin:32px 0;background-color:#d6d6d6;border:0 none}html body table{margin:10px 0 15px 0;border-collapse:collapse;border-spacing:0;display:block;width:100%;overflow:auto;word-break:normal;word-break:keep-all}html body table th{font-weight:bold;color:#000}html body table td,html body table th{border:1px solid #d6d6d6;padding:6px 13px}html body dl{padding:0}html body dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:bold}html body dl dd{padding:0 16px;margin-bottom:16px}html body code{font-family:Menlo,Monaco,Consolas,'Courier New',monospace;font-size:.85em !important;color:#000;background-color:#f0f0f0;border-radius:3px;padding:.2em 0}html body code::before,html body code::after{letter-spacing:-0.2em;content:"\00a0"}html body pre>code{padding:0;margin:0;font-size:.85em !important;word-break:normal;white-space:pre;background:transparent;border:0}html body .highlight{margin-bottom:16px}html body .highlight pre,html body pre{padding:1em;overflow:auto;font-size:.85em !important;line-height:1.45;border:#d6d6d6;border-radius:3px}html body .highlight pre{margin-bottom:0;word-break:normal}html body pre code,html body pre tt{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}html body pre code:before,html body pre tt:before,html body pre code:after,html body pre tt:after{content:normal}html body p,html body blockquote,html body ul,html body ol,html body dl,html body pre{margin-top:0;margin-bottom:16px}html body kbd{color:#000;border:1px solid #d6d6d6;border-bottom:2px solid #c7c7c7;padding:2px 4px;background-color:#f0f0f0;border-radius:3px}@media print{html body{background-color:#fff}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{color:#000;page-break-after:avoid}html body blockquote{color:#5c5c5c}html body pre{page-break-inside:avoid}html body table{display:table}html body img{display:block;max-width:100%;max-height:100%}html body pre,html body code{word-wrap:break-word;white-space:pre}}.markdown-preview{width:100%;height:100%;box-sizing:border-box}.markdown-preview .pagebreak,.markdown-preview .newpage{page-break-before:always}.markdown-preview pre.line-numbers{position:relative;padding-left:3.8em;counter-reset:linenumber}.markdown-preview pre.line-numbers>code{position:relative}.markdown-preview pre.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:1em;font-size:100%;left:0;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.markdown-preview pre.line-numbers .line-numbers-rows>span{pointer-events:none;display:block;counter-increment:linenumber}.markdown-preview pre.line-numbers .line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.8em;text-align:right}.markdown-preview .mathjax-exps .MathJax_Display{text-align:center !important}.markdown-preview:not([for="preview"]) .code-chunk .btn-group{display:none}.markdown-preview:not([for="preview"]) .code-chunk .status{display:none}.markdown-preview:not([for="preview"]) .code-chunk .output-div{margin-bottom:16px}.scrollbar-style::-webkit-scrollbar{width:8px}.scrollbar-style::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}.scrollbar-style::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,0.66);border:4px solid rgba(150,150,150,0.66);background-clip:content-box}html body[for="html-export"]:not([data-presentation-mode]){position:relative;width:100%;height:100%;top:0;left:0;margin:0;padding:0;overflow:auto}html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{position:relative;top:0}@media screen and (min-width:914px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{padding:2em calc(50% - 457px + 2em)}}@media screen and (max-width:914px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{font-size:14px !important;padding:1em}}@media print{html body[for="html-export"]:not([data-presentation-mode]) #sidebar-toc-btn{display:none}}html body[for="html-export"]:not([data-presentation-mode]) #sidebar-toc-btn{position:fixed;bottom:8px;left:8px;font-size:28px;cursor:pointer;color:inherit;z-index:99;width:32px;text-align:center;opacity:.4}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] #sidebar-toc-btn{opacity:1}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc{position:fixed;top:0;left:0;width:300px;height:100%;padding:32px 0 48px 0;font-size:14px;box-shadow:0 0 4px rgba(150,150,150,0.33);box-sizing:border-box;overflow:auto;background-color:inherit}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar{width:8px}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,0.66);border:4px solid rgba(150,150,150,0.66);background-clip:content-box}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc a{text-decoration:none}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc ul{padding:0 1.6em;margin-top:.8em}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc li{margin-bottom:.8em}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc ul{list-style-type:none}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{left:300px;width:calc(100% -  300px);padding:2em calc(50% - 457px -  150px);margin:0;box-sizing:border-box}@media screen and (max-width:1274px){html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{width:100%}}html body[for="html-export"]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .markdown-preview{left:50%;transform:translateX(-50%)}html body[for="html-export"]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .md-sidebar-toc{display:none}
/* Please visit the URL below for more information: */
/*   https://shd101wyy.github.io/markdown-preview-enhanced/#/customize-css */

      </style>
    </head>
    <body for="html-export">
      <div class="mume markdown-preview  ">
      <h1 class="mume-header" id="%E7%AC%AC14%E7%AB%A0-javascript%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E4%B8%8A">&#x7B2C;14&#x7AE0; JavaScript&#x9762;&#x5411;&#x5BF9;&#x8C61;&#xFF08;&#x4E0A;&#xFF09;</h1>

<h2 class="mume-header" id="%E4%B8%80-%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E6%A6%82%E8%BF%B0">&#x4E00;&#x3001;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x6982;&#x8FF0;</h2>

<h3 class="mume-header" id="1-%E9%9D%A2%E5%90%91%E8%BF%87%E7%A8%8B%E4%B8%8E%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1">1&#x3001;&#x9762;&#x5411;&#x8FC7;&#x7A0B;&#x4E0E;&#x9762;&#x5411;&#x5BF9;&#x8C61;</h3>

<p><strong>&#x9762;&#x5411;&#x8FC7;&#x7A0B;&#xFF1A;</strong> &#x9762;&#x5411;&#x8FC7;&#x7A0B;&#x5C31;&#x662F;&#x5206;&#x6790;&#x51FA;&#x89E3;&#x51B3;&#x95EE;&#x9898;&#x9700;&#x8981;&#x7684;&#x6B65;&#x9AA4;&#xFF0C;&#x7136;&#x540E;&#x7528;&#x51FD;&#x6570;&#x628A;&#x8FD9;&#x4E9B;&#x6B65;&#x9AA4;&#x4E00;&#x4E2A;&#x4E2A;&#x5B9E;&#x73B0;&#xFF0C;&#x4F7F;&#x7528;&#x7684;&#x65F6;&#x5019;&#x4F9D;&#x6B21;&#x8C03;&#x7528;&#x3002;&#x9762;&#x5411;&#x8FC7;&#x7A0B;&#x7684;&#x6838;&#x5FC3;&#x662F;&#x8FC7;&#x7A0B;&#x3002;</p>
<p><strong>&#x9762;&#x5411;&#x5BF9;&#x8C61;&#xFF1A;</strong> &#x9762;&#x5411;&#x5BF9;&#x8C61;&#x5C31;&#x662F;&#x628A;&#x9700;&#x8981;&#x89E3;&#x51B3;&#x7684;&#x95EE;&#x9898;&#x5206;&#x89E3;&#x6210;&#x4E00;&#x4E2A;&#x4E2A;&#x5BF9;&#x8C61;&#xFF0C;&#x5EFA;&#x7ACB;&#x5BF9;&#x8C61;&#x4E0D;&#x662F;&#x4E3A;&#x4E86;&#x5B9E;&#x73B0;&#x4E00;&#x4E2A;&#x6B65;&#x9AA4;&#xFF0C;&#x800C;&#x662F;&#x4E3A;&#x4E86;&#x63CF;&#x8FF0;&#x6BCF;&#x4E2A;&#x5BF9;&#x8C61;&#x5728;&#x89E3;&#x51B3;&#x95EE;&#x9898;&#x4E2D;&#x7684;&#x884C;&#x4E3A;&#xFF0C;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7684;&#x6838;&#x5FC3;&#x662F;&#x5BF9;&#x8C61;&#x3002;</p>
<h3 class="mume-header" id="2-%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E7%9A%84%E4%BC%98%E5%8A%BF">2&#x3001;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7684;&#x4F18;&#x52BF;</h3>

<ul>
<li>&#x6A21;&#x5757;&#x5316;&#x66F4;&#x6DF1;&#xFF0C;&#x5C01;&#x88C5;&#x6027;&#x5F3A;&#x3002;</li>
<li>&#x66F4;&#x5BB9;&#x6613;&#x5B9E;&#x73B0;&#x590D;&#x6742;&#x7684;&#x4E1A;&#x52A1;&#x903B;&#x8F91;&#x3002;</li>
<li>&#x66F4;&#x6613;&#x7EF4;&#x62A4;&#x3001;&#x6613;&#x590D;&#x7528;&#x3001;&#x6613;&#x6269;&#x5C55;&#x3002;</li>
</ul>
<h3 class="mume-header" id="3-%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E7%9A%84%E7%89%B9%E5%BE%81">3&#x3001; &#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7684;&#x7279;&#x5F81;</h3>

<ul>
<li>&#x5C01;&#x88C5;&#x6027;&#xFF1B;</li>
<li>&#x591A;&#x6001;&#x6027;&#xFF1B;</li>
<li>&#x7EE7;&#x627F;&#x6027;&#xFF1B;<br>
<img src="../image/mianxiangduixiang.png" alt="&#x9762;&#x5411;&#x5BF9;&#x8C61;"></li>
</ul>
<h2 class="mume-header" id="%E4%BA%8C-es6%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E8%AF%AD%E6%B3%95">&#x4E8C;&#x3001;ES6&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x8BED;&#x6CD5;</h2>

<h3 class="mume-header" id="1-%E7%B1%BB%E5%92%8C%E5%AF%B9%E8%B1%A1">1&#x3001;&#x7C7B;&#x548C;&#x5BF9;&#x8C61;</h3>

<p><strong>&#x7C7B;&#xFF1A;</strong> &#x4E8B;&#x7269;&#x5206;&#x4E3A;&#x5177;&#x4F53;&#x7684;&#x4E8B;&#x7269;&#x548C;&#x62BD;&#x8C61;&#x7684;&#x4E8B;&#x7269;&#xFF0C;&#x5F53;&#x6211;&#x4EEC;&#x8111;&#x4E2D;&#x51FA;&#x73B0;&#x201C;&#x4E66;&#x201D;&#x8FD9;&#x4E2A;&#x8BCD;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x53EF;&#x4EE5;&#x5927;&#x81F4;&#x60F3;&#x8C61;&#x5230;&#x4E66;&#x7684;&#x57FA;&#x672C;&#x6837;&#x8C8C;&#x7279;&#x5F81;&#xFF0C;&#x8FD9;&#x4E2A;&#x8FC7;&#x7A0B;&#x5C31;&#x662F;&#x62BD;&#x8C61;&#xFF0C;&#x62BD;&#x8C61;&#x51FA;&#x6765;&#x7684;&#x7ED3;&#x679C;&#xFF0C;&#x5C31;&#x662F;&#x7C7B;&#x3002;<br>
<strong>&#x5BF9;&#x8C61;&#xFF1A;</strong> &#x800C;&#x5F53;&#x6211;&#x4EEC;&#x62FF;&#x8D77;&#x624B;&#x91CC;&#x7684;&#x4E00;&#x672C;&#x771F;&#x5B9E;&#x5B58;&#x5728;&#x7684;&#x4E66;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x8FD9;&#x672C;&#x4E66;&#x6709;&#x81EA;&#x5DF1;&#x7684;<br>
&#x4E66;&#x540D;&#x3001;&#x4F5C;&#x8005;&#x3001;&#x9875;&#x6570;&#x7B49;&#x4FE1;&#x606F;&#xFF0C;&#x50CF;&#x8FD9;&#x79CD;&#x5177;&#x4F53;&#x7684;&#x4E8B;&#x7269;&#xFF0C;&#x5C31;&#x662F;&#x5BF9;&#x8C61;&#x3002;</p>
<h3 class="mume-header" id="2-%E7%B1%BB%E7%9A%84%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95">2&#x3001;&#x7C7B;&#x7684;&#x57FA;&#x672C;&#x8BED;&#x6CD5;</h3>

<p><strong>class&#x5173;&#x952E;&#x5B57;&#xFF1A;</strong> &#x7528;&#x6765;&#x5B9A;&#x4E49;&#x4E00;&#x4E2A;&#x7C7B;&#xFF0C;&#x5728;&#x7C7B;&#x4E2D;&#x53EF;&#x4EE5;&#x5B9A;&#x4E49;constructor()&#x6784;&#x9020;&#x65B9;&#x6CD5;&#xFF0C;&#x7528;&#x6765;&#x521D;&#x59CB;&#x5316;&#x5BF9;&#x8C61;&#x7684;&#x6210;&#x5458;&#x3002;</p>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token comment">// &#x5B9A;&#x4E49;&#x7C7B;</span>
<span class="token keyword keyword-class">class</span> <span class="token class-name">Person</span> <span class="token punctuation">{</span>
  <span class="token function">constructor</span><span class="token punctuation">(</span><span class="token parameter">name</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">name</span> <span class="token operator">=</span> name<span class="token punctuation">;</span>  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>

<span class="token comment">// &#x5229;&#x7528;&#x7C7B;&#x521B;&#x5EFA;&#x5BF9;&#x8C61;</span>
<span class="token keyword keyword-var">var</span> p1 <span class="token operator">=</span> <span class="token keyword keyword-new">new</span> <span class="token class-name">Person</span><span class="token punctuation">(</span><span class="token string">&apos;&#x5F20;&#x4E09;&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>	<span class="token comment">// &#x521B;&#x5EFA;p1&#x5BF9;&#x8C61;</span>
<span class="token keyword keyword-var">var</span> p2 <span class="token operator">=</span> <span class="token keyword keyword-new">new</span> <span class="token class-name">Person</span><span class="token punctuation">(</span><span class="token string">&apos;&#x674E;&#x56DB;&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>	<span class="token comment">// &#x521B;&#x5EFA;p2&#x5BF9;&#x8C61;</span>
<span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span>p1<span class="token punctuation">.</span><span class="token property-access">name</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token comment">// &#x8BBF;&#x95EE;p1&#x5BF9;&#x8C61;&#x7684;name&#x5C5E;&#x6027;</span>
<span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span>p2<span class="token punctuation">.</span><span class="token property-access">name</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#x8BBF;&#x95EE;p2&#x5BF9;&#x8C61;&#x7684;name&#x5C5E;&#x6027;</span>
</pre><h3 class="mume-header" id="3-%E7%B1%BB%E4%B8%AD%E7%9A%84%E6%96%B9%E6%B3%95">3&#x3001;&#x7C7B;&#x4E2D;&#x7684;&#x65B9;&#x6CD5;</h3>

<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token keyword keyword-class">class</span> <span class="token class-name">Person</span> <span class="token punctuation">{</span>
  <span class="token function">constructor</span><span class="token punctuation">(</span><span class="token parameter">name</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">name</span> <span class="token operator">=</span> name<span class="token punctuation">;</span><span class="token punctuation">}</span>
  <span class="token function">say</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>	<span class="token comment">// &#x5728;&#x7C7B;&#x4E2D;&#x5B9A;&#x4E49;&#x4E00;&#x4E2A;say()&#x65B9;&#x6CD5;</span>
    <span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span><span class="token string">&apos;&#x4F60;&#x597D;&#xFF0C;&#x6211;&#x53EB;&apos;</span> <span class="token operator">+</span> <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">name</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token keyword keyword-var">var</span> p1 <span class="token operator">=</span> <span class="token keyword keyword-new">new</span> <span class="token class-name">Person</span><span class="token punctuation">(</span><span class="token string">&apos;&#x5F20;&#x4E09;&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
p1<span class="token punctuation">.</span><span class="token method function property-access">say</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>	<span class="token comment">// &#x8F93;&#x51FA;&#x7ED3;&#x679C;&#xFF1A;&#x4F60;&#x597D;&#xFF0C;&#x6211;&#x53EB;&#x5F20;&#x4E09;</span>
</pre><h3 class="mume-header" id="4-%E7%BB%A7%E6%89%BF">4&#x3001;&#x7EE7;&#x627F;</h3>

<p><strong>&#x7EE7;&#x627F;&#xFF1A;</strong> &#x5728;JavaScript&#x4E2D;&#xFF0C;&#x7EE7;&#x627F;&#x7528;&#x6765;&#x8868;&#x793A;&#x4E24;&#x4E2A;&#x7C7B;&#x4E4B;&#x95F4;&#x7684;&#x5173;&#x7CFB;&#xFF0C;&#x5B50;&#x7C7B;&#x53EF;&#x4EE5;&#x7EE7;&#x627F;&#x7236;&#x7C7B;&#x7684;&#x4E00;&#x4E9B;&#x5C5E;&#x6027;&#x548C;&#x65B9;&#x6CD5;&#xFF0C;&#x5728;&#x7EE7;&#x627F;&#x4EE5;&#x540E;&#x8FD8;&#x53EF;&#x4EE5;&#x589E;&#x52A0;&#x81EA;&#x5DF1;&#x72EC;&#x6709;&#x7684;&#x5C5E;&#x6027;&#x548C;&#x65B9;&#x6CD5;&#x3002;</p>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token comment">// &#x5148;&#x51C6;&#x5907;&#x4E00;&#x4E2A;&#x7236;&#x7C7B;</span>
<span class="token keyword keyword-class">class</span> <span class="token class-name">Father</span> <span class="token punctuation">{</span>
  <span class="token function">constructor</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>
  <span class="token function">money</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span><span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token comment">// &#x5B50;&#x7C7B;&#x7EE7;&#x627F;&#x7236;&#x7C7B;</span>
<span class="token keyword keyword-class">class</span> <span class="token class-name">Son</span> <span class="token keyword keyword-extends">extends</span> <span class="token class-name">Father</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>

<span class="token comment">// &#x521B;&#x5EFA;&#x5B50;&#x7C7B;&#x5BF9;&#x8C61;</span>
<span class="token keyword keyword-var">var</span> son <span class="token operator">=</span> <span class="token keyword keyword-new">new</span> <span class="token class-name">Son</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
son<span class="token punctuation">.</span><span class="token method function property-access">money</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>	<span class="token comment">// &#x8F93;&#x51FA;&#x7ED3;&#x679C;&#xFF1A;100</span>
</pre><h3 class="mume-header" id="5-super%E5%85%B3%E9%94%AE%E5%AD%97">5&#x3001;super&#x5173;&#x952E;&#x5B57;</h3>

<p>super&#x5173;&#x952E;&#x5B57;&#x8C03;&#x7528;&#x7236;&#x7C7B;&#x7684;&#x666E;&#x901A;&#x65B9;&#x6CD5;&#xFF1A;</p>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token keyword keyword-class">class</span> <span class="token class-name">Father</span> <span class="token punctuation">{</span>
  <span class="token function">say</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token keyword control-flow keyword-return">return</span> <span class="token string">&apos;&#x6211;&#x662F;&#x7236;&#x7C7B;&apos;</span><span class="token punctuation">;</span><span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token keyword keyword-class">class</span> <span class="token class-name">Son</span> <span class="token keyword keyword-extends">extends</span> <span class="token class-name">Father</span> <span class="token punctuation">{</span>
  <span class="token function">say</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span><span class="token keyword keyword-super">super</span><span class="token punctuation">.</span><span class="token method function property-access">say</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">+</span> <span class="token string">&apos;&#x7684;&#x5B50;&#x7C7B;&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token punctuation">}</span>
<span class="token punctuation">}</span>

<span class="token keyword keyword-var">var</span> son <span class="token operator">=</span> <span class="token keyword keyword-new">new</span> <span class="token class-name">Son</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
son<span class="token punctuation">.</span><span class="token method function property-access">say</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token comment">// &#x8F93;&#x51FA;&#x7ED3;&#x679C;&#xFF1A;&#x6211;&#x662F;&#x7236;&#x7C7B;&#x7684;&#x5B50;&#x7C7B;</span>
</pre><h2 class="mume-header" id="%E4%B8%89-%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E5%BC%80%E5%8F%91%E6%A0%87%E7%AD%BE%E9%A1%B5%E7%BB%84%E4%BB%B6">&#x4E09;&#x3001;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x5F00;&#x53D1;&#x6807;&#x7B7E;&#x9875;&#x7EC4;&#x4EF6;</h2>

<h3 class="mume-header" id="1-%E5%8A%9F%E8%83%BD%E5%88%86%E6%9E%90">1&#x3001;&#x529F;&#x80FD;&#x5206;&#x6790;</h3>

<p><img src="..\image\mianxiangduixiangtab.png" alt="&#x6848;&#x4F8B;&#x5206;&#x6790;"></p>
<h3 class="mume-header" id="2-%E9%A1%B5%E9%9D%A2%E7%BB%93%E6%9E%84">2&#x3001;&#x9875;&#x9762;&#x7ED3;&#x6784;</h3>

<h4 class="mume-header" id="%E6%A0%87%E7%AD%BE%E9%A1%B5%E7%BB%84%E4%BB%B6%E7%BB%93%E6%9E%84">&#x6807;&#x7B7E;&#x9875;&#x7EC4;&#x4EF6;&#x7ED3;&#x6784;</h4>

<pre data-role="codeBlock" data-info="html" class="language-html"><span class="token doctype"><span class="token punctuation">&lt;!</span><span class="token doctype-tag">DOCTYPE</span> <span class="token name">html</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>html</span><span class="token punctuation">&gt;</span></span>
  <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>head</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>meta</span> <span class="token attr-name">charset</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>UTF-8<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>title</span><span class="token punctuation">&gt;</span></span>&#x9762;&#x5411;&#x5BF9;&#x8C61; Tab<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>title</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>link</span> <span class="token attr-name">rel</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>stylesheet<span class="token punctuation">&quot;</span></span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>./styles/tab.css<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>link</span> <span class="token attr-name">rel</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>stylesheet<span class="token punctuation">&quot;</span></span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>./styles/style.css<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
  <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>head</span><span class="token punctuation">&gt;</span></span>
  <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>body</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>tabsbox<span class="token punctuation">&quot;</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>tab<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
      <span class="token comment">&lt;!-- &#x6807;&#x7B7E; --&gt;</span>
      <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>nav</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>firstnav<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>ul</span><span class="token punctuation">&gt;</span></span>
          <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>liactive<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>&#x6D4B;&#x8BD5;1<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>iconfont icon-close<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span>
          <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
          <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>&#x6D4B;&#x8BD5;2<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>iconfont icon-close<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span>
          <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
          <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>&#x6D4B;&#x8BD5;3<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>iconfont icon-close<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span>
          <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>ul</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>tabadd<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>+<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
      <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>nav</span><span class="token punctuation">&gt;</span></span>
      <span class="token comment">&lt;!-- &#x5185;&#x5BB9; --&gt;</span>
      <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>tabscon<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>section</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>conactive<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>&#x6D4B;&#x8BD5;1<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>section</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>section</span><span class="token punctuation">&gt;</span></span>&#x6D4B;&#x8BD5;2<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>section</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>section</span><span class="token punctuation">&gt;</span></span>&#x6D4B;&#x8BD5;3<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>section</span><span class="token punctuation">&gt;</span></span>
      <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>script</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>js/tab-12.3.5.js<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span><span class="token script"></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>script</span><span class="token punctuation">&gt;</span></span>
  <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>body</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>html</span><span class="token punctuation">&gt;</span></span>
</pre><h4 class="mume-header" id="%E5%BC%95%E5%85%A5tabjs">&#x5F15;&#x5165;tab.js&#xFF1A;</h4>

<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token operator">&lt;</span>script src<span class="token operator">=</span><span class="token string">&quot;js/tab.js&quot;</span><span class="token operator">&gt;</span><span class="token operator">&lt;</span><span class="token operator">/</span>script<span class="token operator">&gt;</span>
<span class="token comment">// &#x7F16;&#x5199;Tab&#x7C7B;&#xFF0C;&#x7528;&#x6765;&#x521B;&#x5EFA;&#x6807;&#x7B7E;&#x9875;&#x5BF9;&#x8C61;</span>
<span class="token keyword keyword-class">class</span> <span class="token class-name">Tab</span> <span class="token punctuation">{</span>
  <span class="token function">constructor</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>	<span class="token comment">// &#x6784;&#x9020;&#x65B9;&#x6CD5;</span>
  <span class="token function">toggleTab</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>	<span class="token comment">// &#x5207;&#x6362;&#x6807;&#x7B7E;&#x9875;</span>
  <span class="token function">addTab</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>	<span class="token comment">// &#x6DFB;&#x52A0;&#x6807;&#x7B7E;&#x9875;</span>
  <span class="token function">removeTab</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>	<span class="token comment">// &#x5220;&#x9664;&#x6807;&#x7B7E;&#x9875;</span>
  <span class="token function">editTab</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>	<span class="token comment">// &#x4FEE;&#x6539;&#x6807;&#x7B7E;&#x9875;</span>
<span class="token punctuation">}</span>
<span class="token comment">// &#x521B;&#x5EFA;&#x6807;&#x7B7E;&#x9875;&#x5BF9;&#x8C61;</span>
<span class="token keyword keyword-new">new</span> <span class="token class-name">Tab</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><h4 class="mume-header" id="%E7%BB%99tab%E7%B1%BB%E4%BC%A0%E9%80%92id%E5%80%BC">&#x7ED9;Tab&#x7C7B;&#x4F20;&#x9012;id&#x503C;&#xFF1A;</h4>

<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token keyword keyword-new">new</span> <span class="token class-name">Tab</span><span class="token punctuation">(</span><span class="token string">&apos;#tab&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">constructor</span><span class="token punctuation">(</span><span class="token parameter">id</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">main</span> <span class="token operator">=</span> <span class="token dom variable">document</span><span class="token punctuation">.</span><span class="token method function property-access">querySelector</span><span class="token punctuation">(</span>id<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</pre><h3 class="mume-header" id="3-%E5%88%87%E6%8D%A2%E6%A0%87%E7%AD%BE%E9%A1%B5">3&#x3001;&#x5207;&#x6362;&#x6807;&#x7B7E;&#x9875;</h3>

<h4 class="mume-header" id="%E8%8E%B7%E5%8F%96%E9%A1%B5%E9%9D%A2%E5%85%83%E7%B4%A0">&#x83B7;&#x53D6;&#x9875;&#x9762;&#x5143;&#x7D20;&#xFF1A;</h4>

<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">constructor</span><span class="token punctuation">(</span><span class="token parameter">id</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">main</span> <span class="token operator">=</span> <span class="token dom variable">document</span><span class="token punctuation">.</span><span class="token method function property-access">querySelector</span><span class="token punctuation">(</span>id<span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token comment">// &#x5927;&#x76D2;&#x5B50;</span>
  <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">lis</span> <span class="token operator">=</span> <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">main</span><span class="token punctuation">.</span><span class="token method function property-access">querySelectorAll</span><span class="token punctuation">(</span><span class="token string">&apos;li&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#x5C0F;&#x6807;&#x7B7E;</span>
  <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">sections</span> <span class="token operator">=</span>       <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">main</span><span class="token punctuation">.</span><span class="token method function property-access">querySelectorAll</span><span class="token punctuation">(</span><span class="token string">&apos;section&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>	<span class="token comment">// &#x5185;&#x5BB9;&#x533A;&#x57DF;}</span>
  <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token method function property-access">init</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">}</span>
</pre><h4 class="mume-header" id="%E5%88%9D%E5%A7%8B%E5%8C%96">&#x521D;&#x59CB;&#x5316;&#xFF1A;</h4>

<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">init</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword keyword-var">var</span> that <span class="token operator">=</span> <span class="token keyword keyword-this">this</span>
  <span class="token keyword control-flow keyword-for">for</span> <span class="token punctuation">(</span><span class="token keyword keyword-var">var</span> i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span> <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">lis</span><span class="token punctuation">.</span><span class="token property-access">length</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">lis</span><span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span><span class="token property-access">index</span> <span class="token operator">=</span> i<span class="token punctuation">;</span>
    <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">lis</span><span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span><span class="token method-variable function-variable method function property-access">onclick</span> <span class="token operator">=</span> <span class="token keyword keyword-function">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span><span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">index</span><span class="token punctuation">)</span><span class="token punctuation">;</span>  <span class="token comment">// &#x76EE;&#x524D;&#x53EA;&#x83B7;&#x53D6;&#x6807;&#x7B7E;&#x7684;&#x7D22;&#x5F15;&#xFF0C;&#x5176;&#x4ED6;&#x64CD;&#x4F5C;&#x5728;&#x540E;&#x9762;&#x5B9E;&#x73B0;</span>
    that<span class="token punctuation">.</span><span class="token method function property-access">toggleTab</span><span class="token punctuation">(</span><span class="token keyword keyword-this">this</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</pre><h4 class="mume-header" id="%E7%BC%96%E5%86%99toggletab%E6%96%B9%E6%B3%95">&#x7F16;&#x5199;toggleTab()&#x65B9;&#x6CD5;&#xFF1A;</h4>

<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">toggleTab</span><span class="token punctuation">(</span><span class="token parameter">el</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token method function property-access">clearClass</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  el<span class="token punctuation">.</span><span class="token property-access">className</span> <span class="token operator">=</span> <span class="token string">&apos;liactive&apos;</span><span class="token punctuation">;</span>
  <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">sections</span><span class="token punctuation">[</span>el<span class="token punctuation">.</span><span class="token property-access">index</span><span class="token punctuation">]</span><span class="token punctuation">.</span><span class="token property-access">className</span> <span class="token operator">=</span> <span class="token string">&apos;conactive&apos;</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</pre><h4 class="mume-header" id="%E7%BC%96%E5%86%99clearclass%E6%96%B9%E6%B3%95">&#x7F16;&#x5199;clearClass()&#x65B9;&#x6CD5;&#xFF1A;</h4>

<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">clearClass</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword control-flow keyword-for">for</span> <span class="token punctuation">(</span><span class="token keyword keyword-var">var</span> i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span> <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">lis</span><span class="token punctuation">.</span><span class="token property-access">length</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">lis</span><span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span><span class="token property-access">className</span> <span class="token operator">=</span> <span class="token string">&apos;&apos;</span><span class="token punctuation">;</span>
    <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">sections</span><span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span><span class="token property-access">className</span> <span class="token operator">=</span> <span class="token string">&apos;&apos;</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</pre><h3 class="mume-header" id="4-%E6%B7%BB%E5%8A%A0%E6%A0%87%E7%AD%BE%E9%A1%B5">4&#x3001;&#x6DFB;&#x52A0;&#x6807;&#x7B7E;&#x9875;</h3>

<h4 class="mume-header" id="%E4%B8%BA%E7%BB%91%E5%AE%9A%E5%8D%95%E5%87%BB%E4%BA%8B%E4%BB%B6">&#x4E3A;&#x201C;+&#x201D;&#x7ED1;&#x5B9A;&#x5355;&#x51FB;&#x4E8B;&#x4EF6;&#xFF1A;</h4>

<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">constructor</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  &#x2026;&#x2026;&#xFF08;&#x539F;&#x6709;&#x4EE3;&#x7801;&#xFF09;
  <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">add</span> <span class="token operator">=</span> <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">main</span><span class="token punctuation">.</span>
  <span class="token method function property-access">querySelector</span><span class="token punctuation">(</span><span class="token string">&apos;.tabadd&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>	<span class="token comment">// &#x65B0;&#x589E;&#x4EE3;&#x7801;</span>
  <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token method function property-access">init</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token function">init</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword keyword-var">var</span> that <span class="token operator">=</span> <span class="token keyword keyword-this">this</span><span class="token punctuation">;</span>
  <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">add</span><span class="token punctuation">.</span><span class="token method-variable function-variable method function property-access">onclick</span> <span class="token operator">=</span> <span class="token keyword keyword-function">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
   that<span class="token punctuation">.</span><span class="token method function property-access">addTab</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
  &#x2026;&#x2026;&#xFF08;&#x539F;&#x6709;&#x4EE3;&#x7801;&#xFF09;
<span class="token punctuation">}</span>
</pre><h4 class="mume-header" id="%E5%88%9B%E5%BB%BA%E6%96%B0%E6%A0%87%E7%AD%BE%E9%A1%B5%E7%9A%84li%E5%92%8Csection%E5%85%83%E7%B4%A0">&#x521B;&#x5EFA;&#x65B0;&#x6807;&#x7B7E;&#x9875;&#x7684;li&#x548C;section&#x5143;&#x7D20;&#xFF1A;</h4>

<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">constructor</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  &#x2026;&#x2026;&#xFF08;&#x539F;&#x6709;&#x4EE3;&#x7801;&#xFF09;
  <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">ul</span> <span class="token operator">=</span> <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">main</span><span class="token punctuation">.</span><span class="token method function property-access">querySelector</span><span class="token punctuation">(</span><span class="token string">&apos;.firstnav ul:first-child&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#x65B0;&#x589E;</span>
  <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">fsection</span> <span class="token operator">=</span> <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">main</span><span class="token punctuation">.</span><span class="token method function property-access">querySelector</span><span class="token punctuation">(</span><span class="token string">&apos;.tabscon&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#x65B0;&#x589E;</span>
  <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token method function property-access">init</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</pre><h4 class="mume-header" id="%E7%BC%96%E5%86%99addtab%E6%96%B9%E6%B3%95">&#x7F16;&#x5199;addTab()&#x65B9;&#x6CD5;&#xFF1A;</h4>

<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">addTab</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token method function property-access">clearClass</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>  <span class="token comment">// &#x5148;&#x6E05;&#x9664;&#x6240;&#x6709;&#x7684;li&#x548C;section&#x7684;&#x7C7B;</span>
  <span class="token keyword keyword-var">var</span> li <span class="token operator">=</span> &apos;<span class="token operator">&lt;</span>li <span class="token keyword keyword-class">class</span><span class="token operator">=</span><span class="token string">&quot;liactive&quot;</span><span class="token operator">&gt;</span><span class="token operator">&lt;</span>span<span class="token operator">&gt;</span>&#x65B0;&#x6807;&#x7B7E;&#x9875;<span class="token operator">&lt;</span><span class="token operator">/</span>span<span class="token operator">&gt;</span>
  <span class="token operator">&lt;</span>span <span class="token keyword keyword-class">class</span><span class="token operator">=</span><span class="token string">&quot;iconfont icon-close&quot;</span><span class="token operator">&gt;</span><span class="token operator">&lt;</span><span class="token operator">/</span>span<span class="token operator">&gt;</span><span class="token operator">&lt;</span><span class="token operator">/</span>li<span class="token operator">&gt;</span>&apos;<span class="token punctuation">;</span>
  <span class="token keyword keyword-var">var</span> time <span class="token operator">=</span> <span class="token keyword keyword-new">new</span> <span class="token class-name">Date</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">getTime</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token keyword keyword-var">var</span> section <span class="token operator">=</span> <span class="token string">&apos;&lt;section class=&quot;conactive&quot;&gt;&apos;</span> <span class="token operator">+</span> time <span class="token operator">+</span> <span class="token string">&apos;&lt;/section&gt;&apos;</span><span class="token punctuation">;</span>
  <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">ul</span><span class="token punctuation">.</span><span class="token method function property-access">insertAdjacentHTML</span><span class="token punctuation">(</span><span class="token string">&apos;beforeend&apos;</span><span class="token punctuation">,</span> li<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">fsection</span><span class="token punctuation">.</span><span class="token method function property-access">insertAdjacentHTML</span><span class="token punctuation">(</span><span class="token string">&apos;beforeend&apos;</span><span class="token punctuation">,</span> section<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span> 
</pre><h4 class="mume-header" id="%E9%87%8D%E6%96%B0%E8%8E%B7%E5%8F%96thisli%E5%92%8Cthissection%E5%85%83%E7%B4%A0">&#x91CD;&#x65B0;&#x83B7;&#x53D6;this.li&#x548C;this.section&#x5143;&#x7D20;&#xFF1A;</h4>

<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">updateNode</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">lis</span> <span class="token operator">=</span> <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">main</span><span class="token punctuation">.</span><span class="token method function property-access">querySelectorAll</span><span class="token punctuation">(</span><span class="token string">&apos;li&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">sections</span> <span class="token operator">=</span> <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">main</span><span class="token punctuation">.</span><span class="token method function property-access">querySelectorAll</span><span class="token punctuation">(</span><span class="token string">&apos;section&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token function">init</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token comment">// &#x653E;&#x5728;&#x521D;&#x59CB;&#x5316;&#x7684;&#x65F6;&#x5019;&#x8C03;&#x7528;</span>
  <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token method function property-access">updateNode</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  &#x2026;&#x2026;&#xFF08;&#x539F;&#x6709;&#x4EE3;&#x7801;&#xFF09;
<span class="token punctuation">}</span>
</pre><h2 class="mume-header" id="%E6%9C%AC%E7%AB%A0%E6%80%BB%E7%BB%93">&#x672C;&#x7AE0;&#x603B;&#x7ED3;</h2>

<blockquote>
<p>&#x672C;&#x7AE0;&#x9996;&#x5148;&#x4ECB;&#x7ECD;&#x4E86;JavaScript&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7684;&#x7F16;&#x7A0B;&#x601D;&#x60F3;&#xFF0C;&#x5305;&#x62EC;&#x9762;&#x5411;&#x8FC7;&#x7A0B;&#x3001;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7684;&#x4F18;&#x52BF;&#x53CA;&#x7279;&#x5F81;&#x3002;&#x63A5;&#x7740;&#x8BB2;&#x89E3;&#x4E86;ES 6&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7684;&#x8BED;&#x6CD5;&#xFF0C;&#x4E3B;&#x8981;&#x5305;&#x62EC;&#x7C7B;&#x7684;&#x57FA;&#x672C;&#x6982;&#x5FF5;&#x3001;&#x8BED;&#x6CD5;&#x4F7F;&#x7528;&#x3001;&#x65B9;&#x6CD5;&#x3001;&#x5B50;&#x7C7B;&#x5BF9;&#x7236;&#x7C7B;&#x7684;&#x7EE7;&#x627F;&#x53CA;super&#x5173;&#x952E;&#x5B57;&#x7684;&#x4F5C;&#x7528;&#x3002;&#x6700;&#x540E;&#x901A;&#x8FC7;&#x4E00;&#x4E2A;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x5F00;&#x53D1;&#x7684;&#x7EFC;&#x5408;&#x6848;&#x4F8B;&#xFF0C;&#x6F14;&#x793A;&#x4E86;&#x5B9E;&#x9645;&#x5F00;&#x53D1;&#x4E2D;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7684;&#x7F16;&#x7A0B;&#x601D;&#x60F3;&#x548C;&#x7C7B;&#x7684;&#x5E94;&#x7528;&#x3002;&#x901A;&#x8FC7;&#x672C;&#x7AE0;&#x7684;&#x5B66;&#x4E60;&#xFF0C;&#x8BFB;&#x8005;&#x5E94;&#x8BE5;&#x53EF;&#x4EE5;&#x7075;&#x6D3B;&#x8FD0;&#x7528;JavaScript&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7F16;&#x7A0B;&#x601D;&#x60F3;&#x6765;&#x5B8C;&#x6210;&#x9879;&#x76EE;&#x7684;&#x5F00;&#x53D1;&#x3002;</p>
</blockquote>

      </div>
      
      
    
    
    
    
    
    
    
    
  
    </body></html>